package net.wickywicky.ps12;

import java.util.ArrayList;
import java.util.List;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;


public class BandListActivity extends ListActivity {
	private PS12DataHelper datahelper;
	
    /** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);
	  datahelper = new PS12DataHelper(this);
	// We'll define a custom screen layout here (the one shown above), but
      // typically, you could just use the standard ListActivity layout.
      setContentView(R.layout.bandlist);
      setListAdapter(new ArrayAdapter<String>(
    	      this,
    	      android.R.layout.simple_list_item_1, // .simple_expandable_list_item_1,
    	      datahelper.getBandList()));
      //selection=(TextView)findViewById(R.id.selection);

	};

	public void onListItemClick(ListView parent, View view, int position, long id) {
		// TODO Auto-generated method stub
    	Context context = getApplicationContext();
    	CharSequence text = parent.getItemAtPosition(position).toString();
    	int duration = Toast.LENGTH_SHORT;

    	Toast toast = Toast.makeText(context, text, duration);
    	toast.show();			
    	
    	Intent intent = new Intent(parent.getContext(), BandActivity.class);
    	intent.putExtra("band_name",text);
    	startActivity(intent);
	};
	
};


